package com.twu.biblioteca;

import java.util.Iterator;

public class MenuPrinter  {

    private Menu menu;

    public MenuPrinter(final Menu menu) {
        this.menu = menu;
    }


    public void printMenu() {
        Iterator menuIterator = menu.createIterator();
        System.out.println( menu.getDescripton() );
        System.out.println("___________________________");
        printMenu(menuIterator);
    }

    public void printMenu(Iterator iterator) {
        int index = 1;
        while (iterator.hasNext()) {

            MenuItem menuItem = (MenuItem)iterator.next();
            System.out.print(index + ".");
            System.out.println(menuItem.getDescripton());
            index++;
        }
        System.out.println("_____________________________");
    }
}
